Skip to content

Conversation

naemono
Copy link
Contributor

@naemono naemono commented Oct 8, 2025

Picking back up #8278 .
Resolves #8584

This sets some common labels on the ECK operator pod when installed via Helm:

# with change
❯ kc get pod -n elastic-system elastic-operator-0 -o yaml | yq '.metadata.labels'
app.kubernetes.io/instance: elastic-operator
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: elastic-operator
app.kubernetes.io/version: 3.2.0-SNAPSHOT
apps.kubernetes.io/pod-index: "0"
controller-revision-hash: elastic-operator-66cb484647
helm.sh/chart: eck-operator-3.2.0-SNAPSHOT
statefulset.kubernetes.io/pod-name: elastic-operator-0

# without change
❯ kc get pod -n elastic-system elastic-operator-0 -o yaml | yq '.metadata.labels'
app.kubernetes.io/instance: elastic-operator
app.kubernetes.io/name: elastic-operator
apps.kubernetes.io/pod-index: "0"
controller-revision-hash: elastic-operator-7b8ff75c49
statefulset.kubernetes.io/pod-name: elastic-operator-0

It avoids the previous behavior in #8278 where they are also included in generation:

❯ make generate > /dev/null 2>&1 && cat config/operator.yaml | grep -i helm
# no output

@prodsecmachine
Copy link
Collaborator

prodsecmachine commented Oct 8, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@botelastic botelastic bot added the triage label Oct 8, 2025
@naemono naemono added the >feature Adds or discusses adding a feature to the product label Oct 8, 2025
@botelastic botelastic bot removed the triage label Oct 8, 2025
@naemono naemono marked this pull request as ready for review October 8, 2025 20:03
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements standard Kubernetes and Helm labels on ECK operator pods when installed via Helm, while avoiding their inclusion in generated manifests. The change ensures that Helm-managed pods receive proper metadata for better observability and management.

  • Adds conditional logic to include full labels (including Helm metadata) on pods only when not in manifest generation mode
  • Updates test coverage to verify both StatefulSet and pod template labels are correctly applied
  • Maintains backward compatibility by preserving existing behavior during manifest generation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
deploy/eck-operator/templates/statefulset.yaml Adds conditional logic to apply full labels including Helm metadata to pod templates
deploy/eck-operator/templates/tests/statefulset_test.yaml Adds test case to verify pod template labels are correctly applied with custom podLabels

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@naemono naemono changed the title WIP: Use standarad k8s labels and helm labels on pods Use standard k8s labels and helm labels on pods Oct 8, 2025
@naemono naemono changed the title Use standard k8s labels and helm labels on pods Use standard k8s labels and helm labels on ECK Operator pod Oct 8, 2025
Copy link
Contributor

@barkbay barkbay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
(please set the version label on this PR before merging)

@barkbay
Copy link
Contributor

barkbay commented Oct 13, 2025

Is it a fix for #8584?

@naemono
Copy link
Contributor Author

naemono commented Oct 13, 2025

Is it a fix for #8584?

Yes it is. I missed adding that to the initial description, but now have added this. Thank you!

@naemono naemono merged commit 22c77af into elastic:main Oct 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>feature Adds or discusses adding a feature to the product v3.3.0 (next)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Well known labels are missing on the operator Pod

3 participants